<template>
  <div>
    <FilterTable
      ref="repairTable"
      height="auto"
      columnsRef="repairTable"
      :columns="repairColumns"
      selectionType="single"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :datakey="'rows'"
      :onColumnsChange="columns => (this.repairColumns = columns)"
    />

    <FilterTable
      ref="repair1Table"
      height="auto"
      columnsRef="repair1Table"
      :columns="repair1Columns"
      selectionType="single"
      :fetchapi="fetchApi1"
      :params="fetchParams1"
      :datakey="'rows'"
      :onColumnsChange="columns => (this.repair1Columns = columns)"
    />

    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 99,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'center'
      }"
    >
      <el-button>取 消</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'repairModal',
  data() {
    return {
      repairColumns: this.createRepairColumns(),
      repair1Columns: this.createRepair1Columns(),
      fetchApi: () => {},
      fetchParams: { xhrAbort: true },
      fetchApi1: () => {},
      fetchParams1: { xhrAbort: true }
    };
  },
  methods: {
    createRepairColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '经销商简称',
          dataIndex: 'dealer_shortname',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '项目代码',
          dataIndex: 'LABOUR_CODE',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '项目名称',
          dataIndex: 'LABOUR_NAME',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '工时',
          dataIndex: 'STD_LABOUR_HOUR',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '工时费',
          dataIndex: 'LABOUR_AMOUNT',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '不修原因',
          dataIndex: 'REASON',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '建议日期',
          dataIndex: 'SUGGEST_DATE',
          sorter: true,
          filter: true,
          filterType: 'input',
          dateFormat: 'yyyy-MM-dd'
        },
        {
          title: '操作员',
          dataIndex: 'CONTACTOR_ZIP_CODE',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: 'VIN',
          dataIndex: 'VIN',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '车牌号',
          dataIndex: 'LICENSE',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '发动机号',
          dataIndex: 'ENGINE_NO',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '提醒状态',
          dataIndex: 'REMIND_STATUS',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '服务工程师',
          dataIndex: 'SERVICE_ADVISOR_NAME',
          sorter: true,
          filter: true,
          filterType: 'input'
        }
      ];
    },

    createRepair1Columns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '经销商简称',
          dataIndex: 'dealer_shortname',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '备件代码',
          dataIndex: 'PART_NO',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '备件名称',
          dataIndex: 'PART_NAME',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '数量',
          dataIndex: 'QUANTITY',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '单价',
          dataIndex: 'SALES_PRICE',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '不修原因',
          dataIndex: 'REASON',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '建议日期',
          dataIndex: 'SUGGEST_DATE',
          sorter: true,
          filter: true,
          filterType: 'input',
          dateFormat: 'yyyy-MM-dd'
        },
        {
          title: '操作员',
          dataIndex: 'CONTACTOR_ZIP_CODE',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: 'VIN',
          dataIndex: 'VIN',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '车牌号',
          dataIndex: 'LICENSE',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '发动机号',
          dataIndex: 'ENGINE_NO',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '提醒状态',
          dataIndex: 'REMIND_STATUS',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '服务工程师',
          dataIndex: 'SERVICE_ADVISOR_NAME',
          sorter: true,
          filter: true,
          filterType: 'input'
        }
      ];
    }
  }
};
</script>
